![]() |
PATH![]() |
All text handled by JManager functions are stored as JMTextRef objects, which , in addition to the actual text, also specify the text encoding and the length of the string. The following functions let you create or manipulate a JMTextRef object.
OSStatus JMNewTextRef (
JMSessionRef session,
JMTextRef* textRef,
JMTextEncoding encoding,
const void* charBuffer,
UInt32 bufferLengthInBytes
);
The
JMDisposeTextRef
.
The
JMGetTextBytes
function.
OSStatus JMDisposeTextRef(JMTextRef textRef);
The
JMNewTextRef
function.
Returns the length of the string in a text object.
This function returns the string length in characters rather than bytes, since the Unicode standard uses 2 bytes per character, while standard Mac OS encodings and UTF-8 use only 1.
Retrieves characters in a text object in the appropriate text encoding.
The number of characters retrieved is dependent on the size you specify for the buffer as well as on the text encoding. For example, Unicode characters can take 2 bytes per character.
The
JMNewTextRef
function.
Returns the text object as a JNI-style Java string.
jstring JMTextToJNIJavaString (
JMTextRef textRef,
JMSessionRef session,
JNIEnv * env);
This reference is the only reference to the string; if you do not use it, the session will garbage-collect it.
This reference is the only reference to the string; if you do not use it, the session will garbage-collect it.
Unless you specifically need to use the Java Runtime Interface (JRI), you should use the
JMTextToJNIJavaString
function instead.
The
JMTextToMacOSCStringHandle
function.
Returns the text object as a null-terminated Mac OS C string in the current system text encoding.
You must dispose of the handle (by calling the Mac OS Toolbox function DisposeHandle ) after you are finished using it.
IMPORTANT
Since the text conversion is from Unicode to a Mac OS string, some data may be lost if appropriate character mappings do not exist (that is, some Unicode characters may not be represented in the Mac OS encoding). You should be aware that the JMTextToMacOSStringHandle function cannot indicate whether data loss occurred.
The
JMTextToJNIJavaString
function.
Previous | Back Up One Level | Next |